
package std.net

import std.binary.SwapEndianOrder
import std.collection.HashSet
import std.sort.sort
import std.binary.*
import std.convert.*
import std.overflow.{CheckedOp, WrappingOp}
import std.convert.Parsable
import std.binary.{BigEndianOrder, LittleEndianOrder}
import std.binary.{SwapEndianOrder, BigEndianOrder, LittleEndianOrder}
import std.sync.*
import std.overflow.*
import std.io.*
import std.time.*
import std.math.*

@!APILevel[
    since: "22",
    permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
]
public struct AddressFamily <: ToString & Equatable<AddressFamily> {
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const UNSPEC: AddressFamily = AddressFamily("UNSPEC", 0)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const UNIX: AddressFamily = AddressFamily("UNIX", 1)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const INET: AddressFamily = AddressFamily("INET", 2)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const INET6: AddressFamily = AddressFamily("INET6", 10)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const NETLINK: AddressFamily = AddressFamily("NETLINK", 16)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public let name: String
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public let value: UInt16
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public const init(name: String, value: UInt16)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public operator func ==(rhs: AddressFamily): Bool
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public operator func !=(rhs: AddressFamily): Bool
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public func toString(): String
}

@!APILevel[
    since: "22",
    permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
]
sealed abstract class IPAddress <: ToString & Equatable<IPAddress> & Hashable & BigEndianOrder<IPAddress> {
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public prop size: Int64
    
    /**
    * @throws UnsupportedException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public prop hostName: ?String
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    * @throws Exception
    * @throws IllegalFormatException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public static func parse(s: String): IPAddress
    
    /**
    * @throws Exception
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public static func tryParse(s: String): ?IPAddress
    
    /**
    * @throws OutOfMemoryError
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    * @throws Exception
    * @throws IllegalMemoryException
    * @throws IllegalFormatException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public static func resolve(family: AddressFamily, domain: String): Array<IPAddress>
    
    /**
    * @throws OutOfMemoryError
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    * @throws Exception
    * @throws IllegalMemoryException
    * @throws IllegalFormatException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public static func resolve(domain: String): Array<IPAddress>
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func getAddressBytes(): Array<Byte>
    
    /**
    * @throws Exception
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func isIPv4(): Bool
    
    /**
    * @throws Exception
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func isIPv6(): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public open func isUnspecified(): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public open func isLoopback(): Bool
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public open func isMulticast(): Bool
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public open func isPrivate(): Bool
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public open func isLinkLocal(): Bool
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public open func isGlobalUnicast(): Bool
    
    /**
    * @throws IllegalArgumentException
    * @throws IllegalFormatException
    * @throws Exception
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public open func getPrefix(prefixLen: UInt8): IPPrefix
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    * @throws Exception
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public open func writeBigEndian(buffer: Array<Byte>): Int64
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public static func readBigEndian(buffer: Array<Byte>): IPAddress
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public operator func ==(rhs: IPAddress): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public operator func !=(rhs: IPAddress): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws Exception
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func hashCode(): Int64
}






@!APILevel[
    since: "22",
    permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
]
sealed abstract class IPPrefix <: Equatable<IPPrefix> & Hashable & ToString {
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public prop address: IPAddress
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public prop prefixLength: UInt8
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    * @throws Exception
    * @throws IllegalFormatException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public static func parse(s: String): IPPrefix
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    * @throws IllegalFormatException
    * @throws Exception
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public static func tryParse(s: String): ?IPPrefix
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func contains(rhs: IPAddress): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func contains(rhs: IPPrefix): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func overlaps(rhs: IPPrefix): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    * @throws Exception
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public open func netmask(): IPAddress
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    * @throws Exception
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public open func hostmask(): IPAddress
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    * @throws Exception
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public open func broadcast(): IPAddress
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    * @throws Exception
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public open func network(): IPAddress
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    * @throws IllegalFormatException
    * @throws Exception
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public open func masked(): IPPrefix
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public operator func ==(rhs: IPPrefix): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public operator func !=(rhs: IPPrefix): Bool
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public func toString(): String
}

@!APILevel[
    since: "22",
    permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
]
public class IPSocketAddress <: SocketAddress & Equatable<IPSocketAddress> {
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public init(address: Array<Byte>, port: UInt16)
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    * @throws Exception
    * @throws IllegalFormatException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public init(address: String, port: UInt16)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public init(address: IPAddress, port: UInt16)
    
    /**
    * @throws Exception
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public prop size: Int64
    
    /**
    * @throws Exception
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public prop family: AddressFamily
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    * @throws Exception
    * @throws IllegalFormatException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public static func parse(s: String): IPSocketAddress
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    * @throws Exception
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public static func tryParse(s: String): ?IPSocketAddress
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public prop address: IPAddress
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public prop port: UInt16
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    * @throws Exception
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func getAddressBytes(): Array<Byte>
    
    /**
    * @throws Exception
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func isIPv4(): Bool
    
    /**
    * @throws Exception
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func isIPv6(): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public operator func ==(rhs: IPSocketAddress): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public operator func !=(rhs: IPSocketAddress): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws Exception
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func hashCode(): Int64
    
    /**
    * @throws Exception
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func toString(): String
}

@!APILevel[
    since: "22",
    permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
]
public class IPv4Address <: IPAddress & ToString & Equatable<IPv4Address> & LessOrEqual<IPv4Address> {
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static let localhost: IPv4Address = IPv4Address(0x7F, 0, 0, 0x01)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static let unspecified: IPv4Address = IPv4Address(0, 0, 0, 0)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static let broadcast: IPv4Address = IPv4Address(0xFF, 0xFF, 0xFF, 0xFF)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public init(bits: UInt32)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public init(a: Byte, b: Byte, c: Byte, d: Byte)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public func toBits(): UInt32
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func writeBigEndian(buffer: Array<Byte>): Int64
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public static func readBigEndian(buffer: Array<Byte>): IPv4Address
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func isBroadcast(): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func isGlobalUnicast(): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func isLinkLocal(): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func isLoopback(): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func isMulticast(): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func isPrivate(): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func isUnspecified(): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func toIPv6Compatible(): IPv6Address
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func toIPv6Mapped(): IPv6Address
    
    /**
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func getPrefix(prefixLen: UInt8): IPPrefix
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public operator func <=(rhs: IPv4Address): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public operator func ==(rhs: IPv4Address): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public operator func !=(rhs: IPv4Address): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func toString(): String
}


@!APILevel[
    since: "22",
    permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
]
public class IPv6Address <: IPAddress & ToString & Equatable<IPv6Address> & LessOrEqual<IPv6Address> {
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static let localhost: IPv6Address = IPv6Address(0u16, 0, 0, 0, 0, 0, 0, 1)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static let unspecified: IPv6Address = IPv6Address(0u16, 0, 0, 0, 0, 0, 0, 0)
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public init(octets: Array<Byte>, scopeId!: ?UInt32 = None)
    
    /**
    * @throws Exception
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public init(a: UInt16, b: UInt16, c: UInt16, d: UInt16, e: UInt16, f: UInt16, g: UInt16, h: UInt16,
        scopeId!: ?UInt32 = None)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public prop scopeId: ?UInt32
    
    /**
    * @throws IllegalFormatException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func getPrefix(prefixLen: UInt8): IPPrefix
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func toIPv4(): ?IPv4Address
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func toIPv4Mapped(): ?IPv4Address
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func scope(scopeId: ?UInt32): IPv6Address
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func writeBigEndian(buffer: Array<Byte>): Int64
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public static func readBigEndian(buffer: Array<Byte>): IPv6Address
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func isGlobalUnicast(): Bool
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func isIPv4Mapped(): Bool
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func isLinkLocal(): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func isLoopback(): Bool
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func isMulticast(): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func isPrivate(): Bool
    
    /**
    * @throws IllegalArgumentException
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func isTeredo(): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func isUnspecified(): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public operator func <=(rhs: IPv6Address): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public operator func ==(rhs: IPv6Address): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public operator func !=(rhs: IPv6Address): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func toString(): String
}



extend<T> Result<T> <: ToString where T <: ToString {
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public func toString(): String
}


@!APILevel[
    since: "22",
    permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
]
sealed abstract class SocketAddress <: ToString & Equatable<SocketAddress> & Hashable {
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public prop size: Int64
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public prop family: AddressFamily
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public func getAddressBytes(): Array<Byte>
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public operator func ==(rhs: SocketAddress): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public operator func !=(rhs: SocketAddress): Bool
}

@!APILevel[
    since: "22",
    permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
]
public interface StreamingSocket <: IOStream & Resource & ToString {
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    prop localAddress: SocketAddress
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    prop remoteAddress: SocketAddress
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    mut prop readTimeout: ?Duration
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    mut prop writeTimeout: ?Duration
}

@!APILevel[
    since: "22",
    permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
]
public interface DatagramSocket <: Resource & ToString {
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    prop localAddress: SocketAddress
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    prop remoteAddress: ?SocketAddress
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    mut prop receiveTimeout: ?Duration
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    mut prop sendTimeout: ?Duration
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    func receiveFrom(buffer: Array<Byte>): (SocketAddress, Int64)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    func sendTo(address: SocketAddress, payload: Array<Byte>): Unit
}

@!APILevel[
    since: "22",
    permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
]
public interface ServerSocket <: Resource & ToString {
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    prop localAddress: SocketAddress
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    func bind(): Unit
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    func accept(timeout!: ?Duration): StreamingSocket
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    func accept(): StreamingSocket
}

@!APILevel[
    since: "22",
    permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
]
public enum SocketNet <: ToString & Equatable<SocketNet> {
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    TCP |
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    UDP |
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    UNIX
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public func toString(): String
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public operator func ==(that: SocketNet): Bool
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public operator func !=(that: SocketNet): Bool
}


@!APILevel[
    since: "22",
    permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
]
public class SocketException <: IOException {
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public init()
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public init(message: String)
}

@!APILevel[
    since: "22",
    permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
]
public class SocketTimeoutException <: Exception {
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public init()
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public init(message: String)
}



@!APILevel[
    since: "22",
    permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
]
public struct SocketKeepAliveConfig <: ToString & Equatable<SocketKeepAliveConfig> {
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public let idle: Duration
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public let interval: Duration
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public let count: UInt32
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public init(
        idle!: Duration = Duration.second * 45,
        interval!: Duration = Duration.second * 5,
        count!: UInt32 = 5
    )
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public override func toString(): String
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public override operator func ==(other: SocketKeepAliveConfig): Bool
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public override operator func !=(other: SocketKeepAliveConfig): Bool
}

@!APILevel[
    since: "22",
    permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
]
public struct SocketOptions {
    @Deprecated[message: "Use `public static const SOCKET: Int32` in `public struct OptionLevel` instead."]
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const SOL_SOCKET: Int32 = SOL_SOCKET
    
    @Deprecated[message: "Use `public static const TCP: Int32` in `public struct OptionLevel` instead."]
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const IPPROTO_TCP: Int32 = IPPROTO_TCP
    
    @Deprecated[message: "Use `public static const UDP: Int32` in `public struct OptionLevel` instead."]
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const IPPROTO_UDP: Int32 = IPPROTO_UDP
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const SO_KEEPALIVE: Int32 = SOCK_KEEPALIVE
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const TCP_NODELAY: Int32 = SOCK_TCP_NODELAY
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const TCP_QUICKACK: Int32 = SOCK_TCP_QUICKACK
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const SO_LINGER: Int32 = SOCK_LINGER
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const SO_SNDBUF: Int32 = SOCK_SNDBUF
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const SO_RCVBUF: Int32 = SOCK_RCVBUF
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const SO_REUSEADDR: Int32 = SOCK_REUSEADDR
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const SO_REUSEPORT: Int32 = SOCK_REUSEPORT
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const SO_BINDTODEVICE: Int32 = SOCK_BINDTODEVICE
}

@!APILevel[
    since: "22",
    permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
]
public class RawSocket {
    /**
    * @throws IllegalArgumentException
    * @throws SocketException
    */
    @Deprecated[message: "Use `public prop localAddress: RawAddress` instead."]
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public prop localAddr: RawAddress
    
    /**
    * @throws IllegalArgumentException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public prop localAddress: RawAddress
    
    /**
    * @throws IllegalArgumentException
    * @throws SocketException
    */
    @Deprecated[message: "Use `public prop remoteAddress: RawAddress` instead."]
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public prop remoteAddr: RawAddress
    
    /**
    * @throws IllegalArgumentException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public prop remoteAddress: RawAddress
    
    /**
    * @throws [set] IllegalArgumentException
    * @throws [get|set] SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public mut prop readTimeout: ?Duration
    
    /**
    * @throws [set] IllegalArgumentException
    * @throws [get|set] SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public mut prop writeTimeout: ?Duration
    
    /**
    * @throws IllegalArgumentException
    * @throws IllegalMemoryException
    * @throws SocketException
    * @throws SocketTimeoutException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public init(domain: SocketDomain, `type`: SocketType, protocol: ProtocolType)
    
    /**
    * @throws SocketTimeoutException
    * @throws IllegalArgumentException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func bind(addr: RawAddress): Unit
    
    /**
    * @throws SocketException
    * @throws SocketTimeoutException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func listen(backlog: Int32): Unit
    
    /**
    * @throws ArithmeticException
    * @throws SocketTimeoutException
    * @throws IllegalArgumentException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func accept(timeout!: ?Duration = None): RawSocket
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws SocketException
    * @throws SocketTimeoutException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func connect(addr: RawAddress, timeout!: ?Duration = None): Unit
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public func close(): Unit
    
    /**
    * @throws ArithmeticException
    * @throws SocketTimeoutException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func sendTo(addr: RawAddress, buffer: Array<Byte>, flags: Int32): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws SocketTimeoutException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func receiveFrom(buffer: Array<Byte>, flags: Int32): (RawAddress, Int64)
    
    /**
    * @throws ArithmeticException
    * @throws SocketTimeoutException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func send(buffer: Array<Byte>, flags: Int32): Unit
    
    /**
    * @throws ArithmeticException
    * @throws SocketException
    * @throws SocketTimeoutException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func receive(buffer: Array<Byte>, flags: Int32): Int64
    
    /**
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public unsafe func setSocketOption(level: Int32, option: Int32, value: CPointer<Byte>, len: Int32): Unit
    
    /**
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public unsafe func getSocketOption(level: Int32, option: Int32, value: CPointer<Byte>, len: CPointer<Int32>): Unit
}

@!APILevel[
    since: "22",
    permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
]
public struct SocketDomain <: Equatable<SocketDomain> & ToString & Hashable {
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static let IPV4: SocketDomain = SocketDomain(AF_INET)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static let IPV6: SocketDomain = SocketDomain(AF_INET6)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static let UNIX: SocketDomain = SocketDomain(AF_UNIX)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static let NETLINK: SocketDomain = SocketDomain(AF_NETLINK)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static let PACKET: SocketDomain = SocketDomain(AF_PACKET)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public init(domain: Int32)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public operator func ==(r: SocketDomain): Bool
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public operator func !=(r: SocketDomain): Bool
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public func toString(): String
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public func hashCode(): Int64
}

@!APILevel[
    since: "22",
    permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
]
public struct SocketType <: Equatable<SocketType> & ToString & Hashable {
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static let STREAM: SocketType = SocketType(SOCKET_STREAM)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static let DATAGRAM: SocketType = SocketType(SOCKET_DGRAM)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static let RAW: SocketType = SocketType(SOCKET_RAW)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static let SEQPACKET: SocketType = SocketType(SOCKET_SEQPACKET)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public init(`type`: Int32)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public operator func ==(r: SocketType): Bool
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public operator func !=(r: SocketType): Bool
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public func toString(): String
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public func hashCode(): Int64
}

@!APILevel[
    since: "22",
    permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
]
public struct ProtocolType <: Equatable<ProtocolType> & ToString & Hashable {
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static let Unspecified: ProtocolType = ProtocolType(0)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static let IPV4: ProtocolType = ProtocolType(IPPROTO_IPV4)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static let IPV6: ProtocolType = ProtocolType(IPPROTO_IPV6)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static let ICMP: ProtocolType = ProtocolType(IPPROTO_ICMP)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static let TCP: ProtocolType = ProtocolType(IPPROTO_TCP)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static let UDP: ProtocolType = ProtocolType(IPPROTO_UDP)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static let RAW: ProtocolType = ProtocolType(IPPROTO_RAW)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public init(protocol: Int32)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public operator func ==(r: ProtocolType): Bool
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public operator func !=(r: ProtocolType): Bool
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public func toString(): String
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public func hashCode(): Int64
}

@!APILevel[
    since: "22",
    permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
]
public struct OptionLevel {
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const IP: Int32 = IPPROTO_IP
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const TCP: Int32 = IPPROTO_TCP
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const UDP: Int32 = IPPROTO_UDP
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const ICMP: Int32 = IPPROTO_ICMP
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const RAW: Int32 = IPPROTO_RAW
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const SOCKET: Int32 = SOL_SOCKET
}

@!APILevel[
    since: "22",
    permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
]
public struct OptionName {
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const IP_HDRINCL: Int32 = SOCK_IP_HDRINCL
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const IP_TOS: Int32 = SOCK_IP_TOS
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const IP_TTL: Int32 = SOCK_IP_TTL
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const TCP_KEEPCNT: Int32 = SOCK_TCP_KEEPCNT
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const TCP_KEEPIDLE: Int32 = SOCK_TCP_KEEPIDLE
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const TCP_KEEPINTVL: Int32 = SOCK_TCP_KEEPINTVL
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const TCP_NODELAY: Int32 = SOCK_TCP_NODELAY
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const SO_DEBUG: Int32 = SOCK_DEBUG
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const SO_ACCEPTCONN: Int32 = SOCK_ACCEPTCONN
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const SO_REUSEADDR: Int32 = SOCK_REUSEADDR
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const SO_KEEPALIVE: Int32 = SOCK_KEEPALIVE
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const SO_DONTROUTE: Int32 = SOCK_DONTROUTE
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const SO_BROADCAST: Int32 = SOCK_BROADCAST
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const SO_LINGER: Int32 = SOCK_LINGER
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const SO_OOBINLINE: Int32 = SOCK_OOBINLINE
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const SO_SNDBUF: Int32 = SOCK_SNDBUF
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const SO_RCVBUF: Int32 = SOCK_RCVBUF
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const SO_SNDTIMEO: Int32 = SOCK_SNDTIMEO
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const SO_RCVTIMEO: Int32 = SOCK_RCVTIMEO
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public static const SO_ERROR: Int32 = SOCK_ERROR
}

@!APILevel[
    since: "22",
    permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
]
public struct RawAddress {
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public prop addr: Array<Byte>
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public init(addr: Array<Byte>)
}



@!APILevel[
    since: "22",
    permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
]
public class TcpSocket <: StreamingSocket & Equatable<TcpSocket> & Hashable {
    /**
    * @throws OutOfMemoryError
    * @throws Exception
    * @throws IllegalMemoryException
    * @throws IllegalFormatException
    * @throws ArithmeticException
    * @throws IllegalSynchronizationStateException
    * @throws IndexOutOfBoundsException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public init(address: String, port: UInt16)
    
    /**
    * @throws ArithmeticException
    * @throws IllegalSynchronizationStateException
    * @throws IndexOutOfBoundsException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public init(address: SocketAddress)
    
    /**
    * @throws ArithmeticException
    * @throws IllegalSynchronizationStateException
    * @throws IndexOutOfBoundsException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public init(address: SocketAddress, localAddress!: ?SocketAddress)
    
    /**
    * @throws IllegalStateException
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override prop remoteAddress: SocketAddress
    
    /**
    * @throws IllegalStateException
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override prop localAddress: SocketAddress
    
    /**
    * @throws [set] ArithmeticException
    * @throws [set] IllegalArgumentException
    * @throws [get|set] SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override mut prop readTimeout: ?Duration
    
    /**
    * @throws [set] ArithmeticException
    * @throws [set] IllegalArgumentException
    * @throws [get|set] SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override mut prop writeTimeout: ?Duration
    
    /**
    * @throws [get|set] SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public mut prop bindToDevice: ?String
    
    /**
    * @throws [set] OverflowException
    * @throws [set] IllegalStateException
    * @throws [set] IllegalSynchronizationStateException
    * @throws [set] IllegalArgumentException
    * @throws [set] ArithmeticException
    * @throws [get|set] SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public mut prop keepAlive: ?SocketKeepAliveConfig
    
    /**
    * @throws [get|set] SocketException
    * @throws [get|set] OverflowException
    * @throws [get|set] IllegalStateException
    * @throws [get|set] IllegalSynchronizationStateException
    * @throws [get|set] IllegalArgumentException
    * @throws [get|set] ArithmeticException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public mut prop noDelay: Bool
    
    /**
    * @throws [get|set] SocketException
    * @throws [get|set] OverflowException
    * @throws [get|set] IllegalStateException
    * @throws [get|set] IllegalSynchronizationStateException
    * @throws [get|set] IllegalArgumentException
    * @throws [get|set] ArithmeticException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public mut prop quickAcknowledge: Bool
    
    /**
    * @throws [get|set] IllegalMemoryException
    * @throws [get|set] IllegalArgumentException
    * @throws [get|set] ArithmeticException
    * @throws [get|set] SocketException
    * @throws [get|set] OverflowException
    * @throws [get|set] IllegalStateException
    * @throws [get|set] IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public mut prop linger: ?Duration
    
    /**
    * @throws [get|set] SocketException
    * @throws [get|set] OverflowException
    * @throws [get|set] IllegalStateException
    * @throws [get|set] IllegalSynchronizationStateException
    * @throws [get|set] IllegalArgumentException
    * @throws [get|set] ArithmeticException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public mut prop sendBufferSize: Int64
    
    /**
    * @throws [get|set] SocketException
    * @throws [get|set] OverflowException
    * @throws [get|set] IllegalStateException
    * @throws [get|set] IllegalSynchronizationStateException
    * @throws [get|set] IllegalArgumentException
    * @throws [get|set] ArithmeticException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public mut prop receiveBufferSize: Int64
    
    /**
    * @throws SocketException
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override func read(buffer: Array<Byte>): Int64
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override func write(payload: Array<Byte>): Unit
    
    /**
    * @throws IllegalMemoryException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws getOrFail
    * @throws IllegalSynchronizationStateException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func connect(timeout!: ?Duration = None): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func getSocketOption(
        level: Int32,
        option: Int32,
        value: CPointer<Unit>,
        valueLength: CPointer<UIntNative>
    ): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func setSocketOption(
        level: Int32,
        option: Int32,
        value: CPointer<Unit>,
        valueLength: UIntNative
    ): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func getSocketOptionIntNative(
        level: Int32,
        option: Int32
    ): IntNative
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func setSocketOptionIntNative(
        level: Int32,
        option: Int32,
        value: IntNative
    ): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func getSocketOptionBool(
        level: Int32,
        option: Int32
    ): Bool
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func setSocketOptionBool(
        level: Int32,
        option: Int32,
        value: Bool
    ): Unit
    
    /**
    * @throws IllegalArgumentException
    * @throws IllegalStateException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func close(): Unit
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public func isClosed(): Bool
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public override operator func ==(other: TcpSocket): Bool
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public override operator func !=(other: TcpSocket): Bool
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public override func hashCode(): Int64
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override func toString(): String
}

@!APILevel[
    since: "22",
    permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
]
public class TcpServerSocket <: ServerSocket {
    /**
    * @throws IllegalStateException
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override prop localAddress: SocketAddress
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public init(bindAt!: UInt16)
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public init(bindAt!: SocketAddress)
    
    /**
    * @throws [get|set] SocketException
    * @throws [get|set] OverflowException
    * @throws [get|set] IllegalStateException
    * @throws [get|set] IllegalSynchronizationStateException
    * @throws [get|set] IllegalArgumentException
    * @throws [get|set] ArithmeticException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public mut prop reuseAddress: Bool
    
    /**
    * @throws [get|set] SocketException
    * @throws [get|set] OverflowException
    * @throws [get|set] IllegalStateException
    * @throws [get|set] IllegalSynchronizationStateException
    * @throws [get|set] IllegalArgumentException
    * @throws [get|set] ArithmeticException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public mut prop reusePort: Bool
    
    /**
    * @throws [get|set] SocketException
    * @throws [get|set] OverflowException
    * @throws [get|set] IllegalStateException
    * @throws [get|set] IllegalSynchronizationStateException
    * @throws [get|set] IllegalArgumentException
    * @throws [get|set] ArithmeticException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public mut prop sendBufferSize: Int64
    
    /**
    * @throws [get|set] SocketException
    * @throws [get|set] OverflowException
    * @throws [get|set] IllegalStateException
    * @throws [get|set] IllegalSynchronizationStateException
    * @throws [get|set] IllegalArgumentException
    * @throws [get|set] ArithmeticException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public mut prop receiveBufferSize: Int64
    
    /**
    * @throws [get|set] SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public mut prop bindToDevice: ?String
    
    /**
    * @throws [set] IllegalArgumentException
    * @throws [set] SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public mut prop backlogSize: Int64
    
    /**
    * @throws IllegalMemoryException
    * @throws ArithmeticException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws IllegalSynchronizationStateException
    * @throws SocketException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override func bind(): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override func accept(timeout!: ?Duration): TcpSocket
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override func accept(): TcpSocket
    
    /**
    * @throws IllegalArgumentException
    * @throws IllegalStateException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override func close(): Unit
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public override func isClosed(): Bool
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func getSocketOption(
        level: Int32,
        option: Int32,
        value: CPointer<Unit>,
        valueLength: CPointer<UIntNative>
    ): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func setSocketOption(
        level: Int32,
        option: Int32,
        value: CPointer<Unit>,
        valueLength: UIntNative
    ): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func getSocketOptionIntNative(
        level: Int32,
        option: Int32
    ): IntNative
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func setSocketOptionIntNative(
        level: Int32,
        option: Int32,
        value: IntNative
    ): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func getSocketOptionBool(
        level: Int32,
        option: Int32
    ): Bool
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func setSocketOptionBool(
        level: Int32,
        option: Int32,
        value: Bool
    ): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override func toString(): String
}

@!APILevel[
    since: "22",
    permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
]
public class UdpSocket <: DatagramSocket {
    /**
    * @throws SocketException
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public init(bindAt!: UInt16)
    
    /**
    * @throws SocketException
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public init(bindAt!: SocketAddress)
    
    /**
    * @throws SocketException
    * @throws IllegalStateException
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override prop remoteAddress: ?SocketAddress
    
    /**
    * @throws IllegalStateException
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override prop localAddress: SocketAddress
    
    /**
    * @throws [set] ArithmeticException
    * @throws [set] IllegalArgumentException
    * @throws [get|set] SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override mut prop receiveTimeout: ?Duration
    
    /**
    * @throws [set] ArithmeticException
    * @throws [set] IllegalArgumentException
    * @throws [get|set] SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override mut prop sendTimeout: ?Duration
    
    /**
    * @throws IllegalArgumentException
    * @throws IllegalStateException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override func close(): Unit
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public override func isClosed(): Bool
    
    /**
    * @throws IllegalMemoryException
    * @throws ArithmeticException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws IllegalSynchronizationStateException
    * @throws SocketException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func bind(): Unit
    
    /**
    * @throws IllegalMemoryException
    * @throws IndexOutOfBoundsException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws ArithmeticException
    * @throws getOrFail
    * @throws IllegalSynchronizationStateException
    * @throws SocketException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func connect(remote: SocketAddress): Unit
    
    /**
    * @throws IllegalMemoryException
    * @throws SocketException
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func disconnect(): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws IllegalArgumentException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override func receiveFrom(buffer: Array<Byte>): (SocketAddress, Int64)
    
    /**
    * @throws ArithmeticException
    * @throws IllegalSynchronizationStateException
    * @throws IndexOutOfBoundsException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override func sendTo(recipient: SocketAddress, payload: Array<Byte>): Unit
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws OverflowException
    * @throws IllegalStateException
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func send(payload: Array<Byte>): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws IllegalArgumentException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func receive(buffer: Array<Byte>): Int64
    
    /**
    * @throws [get|set] SocketException
    * @throws [get|set] OverflowException
    * @throws [get|set] IllegalStateException
    * @throws [get|set] IllegalSynchronizationStateException
    * @throws [get|set] IllegalArgumentException
    * @throws [get|set] ArithmeticException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public mut prop reusePort: Bool
    
    /**
    * @throws [get|set] SocketException
    * @throws [get|set] OverflowException
    * @throws [get|set] IllegalStateException
    * @throws [get|set] IllegalSynchronizationStateException
    * @throws [get|set] IllegalArgumentException
    * @throws [get|set] ArithmeticException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public mut prop reuseAddress: Bool
    
    /**
    * @throws [get|set] SocketException
    * @throws [get|set] OverflowException
    * @throws [get|set] IllegalStateException
    * @throws [get|set] IllegalSynchronizationStateException
    * @throws [get|set] IllegalArgumentException
    * @throws [get|set] ArithmeticException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public mut prop sendBufferSize: Int64
    
    /**
    * @throws [get|set] SocketException
    * @throws [get|set] OverflowException
    * @throws [get|set] IllegalStateException
    * @throws [get|set] IllegalSynchronizationStateException
    * @throws [get|set] IllegalArgumentException
    * @throws [get|set] ArithmeticException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public mut prop receiveBufferSize: Int64
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func getSocketOption(
        level: Int32,
        option: Int32,
        value: CPointer<Unit>,
        valueLength: CPointer<UIntNative>
    ): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func setSocketOption(
        level: Int32,
        option: Int32,
        value: CPointer<Unit>,
        valueLength: UIntNative
    ): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func getSocketOptionIntNative(
        level: Int32,
        option: Int32
    ): IntNative
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func setSocketOptionIntNative(
        level: Int32,
        option: Int32,
        value: IntNative
    ): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func getSocketOptionBool(
        level: Int32,
        option: Int32
    ): Bool
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func setSocketOptionBool(
        level: Int32,
        option: Int32,
        value: Bool
    ): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override func toString(): String
}

@!APILevel[
    since: "22",
    permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
]
public class UnixSocket <: StreamingSocket {
    /**
    * @throws IndexOutOfBoundsException
    * @throws SocketException
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public init(path: String, localPath!: ?String = None)
    
    /**
    * @throws SocketException
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public init(address: SocketAddress, localAddress!: ?SocketAddress = None)
    
    /**
    * @throws IllegalStateException
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override prop remoteAddress: SocketAddress
    
    /**
    * @throws IllegalStateException
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override prop localAddress: SocketAddress
    
    /**
    * @throws [set] ArithmeticException
    * @throws [set] IllegalArgumentException
    * @throws [get|set] SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override mut prop readTimeout: ?Duration
    
    /**
    * @throws [set] ArithmeticException
    * @throws [set] IllegalArgumentException
    * @throws [get|set] SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override mut prop writeTimeout: ?Duration
    
    /**
    * @throws [get|set] SocketException
    * @throws [get|set] OverflowException
    * @throws [get|set] IllegalStateException
    * @throws [get|set] IllegalSynchronizationStateException
    * @throws [get|set] IllegalArgumentException
    * @throws [get|set] ArithmeticException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public mut prop sendBufferSize: Int64
    
    /**
    * @throws [get|set] SocketException
    * @throws [get|set] OverflowException
    * @throws [get|set] IllegalStateException
    * @throws [get|set] IllegalSynchronizationStateException
    * @throws [get|set] IllegalArgumentException
    * @throws [get|set] ArithmeticException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public mut prop receiveBufferSize: Int64
    
    /**
    * @throws SocketException
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override func read(buffer: Array<Byte>): Int64
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override func write(buffer: Array<Byte>): Unit
    
    /**
    * @throws IllegalMemoryException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws getOrFail
    * @throws IllegalSynchronizationStateException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func connect(timeout!: ?Duration = None): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func getSocketOption(
        level: Int32,
        option: Int32,
        value: CPointer<Unit>,
        valueLength: CPointer<UIntNative>
    ): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func setSocketOption(
        level: Int32,
        option: Int32,
        value: CPointer<Unit>,
        valueLength: UIntNative
    ): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func getSocketOptionIntNative(
        level: Int32,
        option: Int32
    ): IntNative
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func setSocketOptionIntNative(
        level: Int32,
        option: Int32,
        value: IntNative
    ): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func getSocketOptionBool(
        level: Int32,
        option: Int32
    ): Bool
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func setSocketOptionBool(
        level: Int32,
        option: Int32,
        value: Bool
    ): Unit
    
    /**
    * @throws IllegalArgumentException
    * @throws IllegalStateException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func close(): Unit
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public func isClosed(): Bool
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override func toString(): String
}

@!APILevel[
    since: "22",
    permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
]
public class UnixServerSocket <: ServerSocket {
    /**
    * @throws IllegalStateException
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override prop localAddress: SocketAddress
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws SocketException
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public init(bindAt!: String)
    
    /**
    * @throws SocketException
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public init(bindAt!: SocketAddress)
    
    /**
    * @throws [get|set] SocketException
    * @throws [get|set] OverflowException
    * @throws [get|set] IllegalStateException
    * @throws [get|set] IllegalSynchronizationStateException
    * @throws [get|set] IllegalArgumentException
    * @throws [get|set] ArithmeticException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public mut prop sendBufferSize: Int64
    
    /**
    * @throws [get|set] SocketException
    * @throws [get|set] OverflowException
    * @throws [get|set] IllegalStateException
    * @throws [get|set] IllegalSynchronizationStateException
    * @throws [get|set] IllegalArgumentException
    * @throws [get|set] ArithmeticException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public mut prop receiveBufferSize: Int64
    
    /**
    * @throws [set] IllegalArgumentException
    * @throws [set] SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public mut prop backlogSize: Int64
    
    /**
    * @throws IllegalMemoryException
    * @throws ArithmeticException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws IllegalSynchronizationStateException
    * @throws SocketException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override func bind(): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override func accept(timeout!: ?Duration): UnixSocket
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override func accept(): UnixSocket
    
    /**
    * @throws IllegalArgumentException
    * @throws IllegalStateException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override func close(): Unit
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public override func isClosed(): Bool
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func getSocketOption(
        level: Int32,
        option: Int32,
        value: CPointer<Unit>,
        valueLength: CPointer<UIntNative>
    ): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func setSocketOption(
        level: Int32,
        option: Int32,
        value: CPointer<Unit>,
        valueLength: UIntNative
    ): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func getSocketOptionIntNative(
        level: Int32,
        option: Int32
    ): IntNative
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func setSocketOptionIntNative(
        level: Int32,
        option: Int32,
        value: IntNative
    ): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func getSocketOptionBool(
        level: Int32,
        option: Int32
    ): Bool
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func setSocketOptionBool(
        level: Int32,
        option: Int32,
        value: Bool
    ): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override func toString(): String
}

@!APILevel[
    since: "22",
    permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
]
public class UnixDatagramSocket <: DatagramSocket {
    /**
    * @throws IndexOutOfBoundsException
    * @throws SocketException
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public init(bindAt!: String)
    
    /**
    * @throws SocketException
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public init(bindAt!: SocketAddress)
    
    /**
    * @throws SocketException
    * @throws IllegalStateException
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override prop remoteAddress: ?SocketAddress
    
    /**
    * @throws IllegalStateException
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override prop localAddress: SocketAddress
    
    /**
    * @throws [set] ArithmeticException
    * @throws [set] IllegalArgumentException
    * @throws [get|set] SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override mut prop receiveTimeout: ?Duration
    
    /**
    * @throws [set] ArithmeticException
    * @throws [set] IllegalArgumentException
    * @throws [get|set] SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override mut prop sendTimeout: ?Duration
    
    /**
    * @throws IllegalArgumentException
    * @throws IllegalStateException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override func close(): Unit
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public override func isClosed(): Bool
    
    /**
    * @throws IllegalMemoryException
    * @throws ArithmeticException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws IllegalSynchronizationStateException
    * @throws SocketException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func bind(): Unit
    
    /**
    * @throws IllegalMemoryException
    * @throws IndexOutOfBoundsException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws getOrFail
    * @throws IllegalSynchronizationStateException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func connect(remotePath: String): Unit
    
    /**
    * @throws IllegalMemoryException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws getOrFail
    * @throws IllegalSynchronizationStateException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func connect(remote: SocketAddress): Unit
    
    /**
    * @throws IllegalMemoryException
    * @throws SocketException
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func disconnect(): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws IllegalArgumentException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override func receiveFrom(buffer: Array<Byte>): (SocketAddress, Int64)
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override func sendTo(recipient: SocketAddress, payload: Array<Byte>): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func send(payload: Array<Byte>): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws IllegalArgumentException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func receive(buffer: Array<Byte>): Int64
    
    /**
    * @throws [get|set] SocketException
    * @throws [get|set] OverflowException
    * @throws [get|set] IllegalStateException
    * @throws [get|set] IllegalSynchronizationStateException
    * @throws [get|set] IllegalArgumentException
    * @throws [get|set] ArithmeticException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public mut prop sendBufferSize: Int64
    
    /**
    * @throws [get|set] SocketException
    * @throws [get|set] OverflowException
    * @throws [get|set] IllegalStateException
    * @throws [get|set] IllegalSynchronizationStateException
    * @throws [get|set] IllegalArgumentException
    * @throws [get|set] ArithmeticException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public mut prop receiveBufferSize: Int64
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func getSocketOption(
        level: Int32,
        option: Int32,
        value: CPointer<Unit>,
        valueLength: CPointer<UIntNative>
    ): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func setSocketOption(
        level: Int32,
        option: Int32,
        value: CPointer<Unit>,
        valueLength: UIntNative
    ): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func getSocketOptionIntNative(
        level: Int32,
        option: Int32
    ): IntNative
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func setSocketOptionIntNative(
        level: Int32,
        option: Int32,
        value: IntNative
    ): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func getSocketOptionBool(
        level: Int32,
        option: Int32
    ): Bool
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    * @throws SocketException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func setSocketOptionBool(
        level: Int32,
        option: Int32,
        value: Bool
    ): Unit
    
    /**
    * @throws ArithmeticException
    * @throws IllegalArgumentException
    * @throws IllegalSynchronizationStateException
    * @throws IllegalStateException
    * @throws OverflowException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public override func toString(): String
}

@!APILevel[
    since: "22",
    permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
]
public class UnixSocketAddress <: SocketAddress & Equatable<UnixSocketAddress> {
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public init(path: Array<Byte>)
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public init(path: String)
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public prop size: Int64
    
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET"
    ]
    public prop family: AddressFamily
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public operator func ==(rhs: UnixSocketAddress): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public operator func !=(rhs: UnixSocketAddress): Bool
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func getAddressBytes(): Array<Byte>
    
    /**
    * @throws IndexOutOfBoundsException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func hashCode(): Int64
    
    /**
    * @throws IndexOutOfBoundsException
    * @throws IllegalArgumentException
    */
    @!APILevel[
        since: "22",
        permission: "ohos.permission.GET_NETWORK_INFO" & "ohos.permission.INTERNET",
        throwexception: true
    ]
    public func toString(): String
}

